package thread;

import java.util.Arrays;
import java.util.List;

public class ThreadDemo02 {
    public static void main(String[] args) {
        System.out.println(Thread.currentThread().getName());
        ThreadTask1 task1 = new ThreadTask1();
        ThreadTask2 task2 = new ThreadTask2();

        Thread t1 = new Thread(task1);
        Thread t2 = new Thread(task2);

        Thread t3 = new Thread(()->{
            String tName = Thread.currentThread().getName();
            for (int i = 0; i < 10; i++) {
                System.out.println(tName+"MyRunnable3");
            }
            }
        );


        t1.start();
        t2.start();
        t3.start();

    }

}

class ThreadTask1 implements Runnable{
    @Override
    public void run() {
        String tName = Thread.currentThread().getName();
        for (int i = 0; i < 10; i++) {

            System.out.println(tName+"MyRunnable1");
        }
    }
}

class ThreadTask2 implements Runnable{
    @Override
    public void run() {
        String tName = Thread.currentThread().getName();
        for (int i = 0; i < 10; i++) {

            System.out.println(tName+"MyRunnable2");
        }
    }
}
